9
9
# ------------------------------------------------------------------------------
10
10
# @TODO: Add yes mode (-y / --yes) to run without questions
11
11
# ------------------------------------------------------------------------------
12
+ # @FIXME: Merge commit happens from the wrong author
13
+ # ------------------------------------------------------------------------------
14
+ # @FIXME: The cleanup gives errors if cleanup is run before/without the split being run
15
+ # ------------------------------------------------------------------------------
12
16
# @FIXME: Add "aggressive" mode that creates a commit on the source branch (?before/after? merge)
13
17
# of the source file with all of the lines from the split file removed.
14
18
# - Using grep?
32
36
# # things to be after the file has been split.
33
37
# # - <target-path> is the directory where the split files should be committed to
34
38
# # - <split-strategy> is the strategy that should be applied to the source-file
35
- # # Can be one of DELETE | KEEP | MOVE
39
+ # # Can be one of DELETE | MOVE
36
40
# #
37
41
# / Usually when you want to split a file into several files under git, you would
38
42
# / loose the git history of this file. Often this is not desirable. The goal of
@@ -251,9 +255,9 @@ handleParams() {
251
255
readonly g_sSplitDirectory=" ${sSplitDirectory} "
252
256
fi
253
257
254
- if [[ " ${g_sStrategy} " != ' DELETE' && " ${g_sStrategy} " != ' KEEP ' && " ${g_sStrategy} " != ' MOVE' ]]; then
258
+ if [[ " ${g_sStrategy} " != ' DELETE' && " ${g_sStrategy} " != ' MOVE' ]]; then
255
259
g_iExitCode=71
256
- error " The given split strategy '${g_sStrategy} ' is not one of supported DELETE | KEEP | MOVE"
260
+ error " The given split strategy '${g_sStrategy} ' is not one of supported DELETE | MOVE"
257
261
fi
258
262
fi
259
263
@@ -413,11 +417,11 @@ createSubBranches() {
413
417
414
418
printTopic ' Creating sub-branches'
415
419
for sFile in " ${g_sSplitDirectory} /" * ; do
416
- # if [[ "${sFile}" = "${g_sSourceFileName}" ]];then
417
- # printStatus "Skipping branch for source file '${g_sSourceFileName}'"
418
- # else
420
+ # if [[ "${sFile}" = "${g_sSourceFileName}" && "${g_sStrategy}" != "MOVE " ]];then
421
+ # printStatus "Skipping branch for source file '${g_sSourceFileName}'"
422
+ # else
419
423
createSplitBranch " ${sFile} "
420
- # fi
424
+ # fi
421
425
done
422
426
}
423
427
@@ -541,20 +545,20 @@ run() {
541
545
printTopic " Running split process for source file '${g_sSourceFileName} '"
542
546
checkoutSourceBranch
543
547
544
- if [[ ${g_sStrategy} = ' KEEP' ]]; then
545
- echo ' @CHECKME: Nothing to do?'
546
- elif [[ ${g_sStrategy} = ' MOVE' ]]; then
548
+ if [[ ${g_sStrategy} = ' MOVE' ]]; then
547
549
commitFileContent " ${g_sSourceFileName} "
550
+ mergeSplitBranch " ${g_sSourceFileName} "
548
551
elif [[ ${g_sStrategy} = ' DELETE' ]]; then
549
- git rm " ${g_sSourceFilePath} "
550
- commit " Removes '${g_sSourceFilePath} ' file that has been split."
552
+ printStatus ' Nothing to do for DELETE as file has already been renamed.'
553
+ # git rm "${g_sSourceFilePath}"
554
+ # commit "Removes '${g_sSourceFilePath}' file that has been split."
551
555
else
552
556
error " Unsupported merge strategy '${g_sStrategy} '" 70
553
557
fi
554
- mergeSplitBranch " ${g_sSourceFileName} "
555
558
556
559
printTopic " Merging source branch '${g_sSourceBranch} ' into the root branch '${g_sRootBranch} '"
557
560
checkoutRootBranch
561
+
558
562
git merge --no-ff --no-edit " ${g_sSourceBranch} "
559
563
else
560
564
printMessage ' Aborting.'
@@ -572,7 +576,6 @@ finish() {
572
576
if [[ ${g_iExitCode} -eq 65 ]]; then
573
577
shortUsage
574
578
echo ' Call --help for more details'
575
-
576
579
fi
577
580
fi
578
581
@@ -592,7 +595,7 @@ finish() {
592
595
exit ${g_iExitCode}
593
596
}
594
597
595
- function debugTrapMessage {
598
+ debugTrapMessage () {
596
599
printDebug " ${g_sColorDim} [${1} :${2} ] ${3}${g_sColorRestore} "
597
600
}
598
601
0 commit comments