Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Tue, 30 Mar 2010 04:29:24 +0000 (21:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Mar 2010 04:29:24 +0000 (21:29 -0700)
* maint:
format-patch: Squelch 'fatal: Not a range." error

builtin/log.c
t/t4014-format-patch.sh
index a8dd8c989c5a135e14c6fc06ea3b23f4f0cd0bec..542ecc708bdb830bcdbbd48e3fb3d21021119630 100644 (file)
@@ -1157,8 +1157,15 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                        return 0;
        }
 
-       if (ignore_if_in_upstream)
+       if (ignore_if_in_upstream) {
+               /* Don't say anything if head and upstream are the same. */
+               if (rev.pending.nr == 2) {
+                       struct object_array_entry *o = rev.pending.objects;
+                       if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0)
+                               return 0;
+               }
                get_patch_ids(&rev, &ids, prefix);
+       }
 
        if (!use_stdout)
                realstdout = xfdopen(xdup(1), "w");
index c7b625642dd57f4bcb6f7c5aa240cc9c32e15af8..d21c37f3a20c42b05044e45c5e5af71294c8420c 100755 (executable)
@@ -609,4 +609,8 @@ test_expect_success 'format-patch -- <path>' '
        ! grep "Use .--" error
 '
 
+test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '
+       git format-patch --ignore-if-in-upstream HEAD
+'
+
 test_done