I noticed that there is no safe way to give a revision to git-blame:
it can always be interpreted as an existing file:
- "git blame rev -- file.txt" can fail if "rev" is a file
- "git blame rev^0 -- file.txt" can file there is a "rev^0" file
(happens if you type too fast with a tool not designed for keyboard)
- "git blame file.txt rev" is ambiguos too, for the same reasons.
I did the simple patch (below) to resolve at least the very first one,
just because that is how git-rev-list does it.
But if all forms of git-blame command line are expected to live, a
more serious surgery of the argv[] handling code needed.
And I afraid the patch has a small chance of crashing: I don't check
if there is enough space in argv (don't actually even know how to),
so Junio, please do not apply it (it passes blame tests, though).
I also suspect git-blame is not the only command using revision
machinery which has the same problem, so this message is more like a
discussion starter.
diff --git a/builtin-blame.c b/builtin-blame.c
index 066dee7..83c8905 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -1787,6 +1787,7 @@ int cmd_blame(int argc, const char **arg
/* Now we got rev and path. We do not want the path pruning
* but we may want "bottom" processing.
*/
+ argv[unk++] = "--";
argv[unk] = NULL;
init_revisions(&revs, NULL);
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Con Kolivas | Re: [REPORT] cfs-v4 vs sd-0.44 |
| Tim Tassonis | reiser4 for 2.6.27-rc1 |
| Eric Sandeen | [PATCH 4/4] ext4: call blkdev_issue_flush on fsync |
| Greg Kroah-Hartman | [PATCH 006/196] Chinese: add translation of oops-tracing.txt |
git: | |
| Junichi Uekawa | Re: [ANNOUNCE] GIT 1.5.4 |
| Mark Levedahl | rc4 - make quick-install-doc is broken |
| Ingo Molnar | [OT] Your branch is ahead of the tracked remote branch 'origin/master' by 50 commi... |
| Junio C Hamano | Re: Decompression speed: zip vs lzo |
| Richard Stallman | Real men don't attack straw men |
| Girish Venkatachalam | Thinkpad t61 OpenBSD support? |
| David Newman | setting dscp or tos bits |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Radu Rendec | Endianness problem with u32 classifier hash masks |
| Bruno Randolf | [PATCH] add macro for printing mac addresses |
| Ilpo Järvinen | [RFC PATCH 6/8] [NET]: uninline skb_trim, de-bloats |
| Jeff Kirsher | [NET-NEXT PATCH 0/9] e1000: update and cleanups |
