summaryrefslogtreecommitdiff
blob: f921efd9be22fdddea03b696f4a35e62fdc1280b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
diff --git a/git-restore-mtime b/git-restore-mtime
index fbc05d9..7bbd375 100755
--- a/git-restore-mtime
+++ b/git-restore-mtime
@@ -74,6 +74,14 @@ parser.add_argument('--merge', '-m',
                         'sometimes substantially. By default merge logs are only '
                         'used for files missing from regular commit logs.')
 
+parser.add_argument('--first-parent',
+                    action="store_true",
+                    help='pass --first-parent to git whatchanged to hide the '
+                        'second parent from the merge commit logs. Only has any '
+                        'effect if --merge is also specified or --skip-missing '
+                        'is not specified and there were files not found in regular '
+                        'commit logs.')
+
 parser.add_argument('--skip-missing', '-s',
                     action="store_false", default=True, dest='missing',
                     help='do not try to find missing files. If some files were '
@@ -252,6 +260,7 @@ def parselog(merge=False, filterlist=[]):
 
     gitobj = subprocess.Popen(gitcmd + shlex.split('whatchanged --pretty={}'.format(args.timeformat)) +
                               (['-m'] if merge else []) +
+                              (['--first-parent'] if args.first_parent else []) +
                               ['--'] + filterlist,
                               stdout=subprocess.PIPE)
     for line in gitobj.stdout: