{"thread":{"id":"1716","subject":"[PATCH 2/4] Fix cg-{diff,mkpatch} with HEAD^","startedAt":"2005-09-02T10:31:25Z","lastAt":"2005-09-13T17:41:24Z","messageCount":6,"participants":["Paolo 'Blaisorblade' Giarrusso","Petr Baudis","Blaisorblade"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"8012","messageId":"20050902103125.24918.905.stgit@zion.home.lan","threadId":"1716","inReplyTo":null,"subject":"[PATCH 1/4] Fix txt installation","fromName":"Paolo 'Blaisorblade' Giarrusso","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-09-02T10:31:25Z","receivedAt":"2005-09-02T10:31:25Z","isPatch":true,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"Avoid make removing the txt files. They are removed because there's no\nexplicit dependance on them, thus they are intermediate files and thus get\nremoved by make.\n\nAlso, while at this, avoid listing all those build-generated files in\ncg-status (i.e. edit .gitignore).\n---\n\n .gitignore             |    2 ++\n Documentation/Makefile |    7 +++++--\n 2 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\n--- a/.gitignore\n+++ b/.gitignore\n@@ -1 +1,3 @@\n cg-version\n+Documentation/*.[17]\n+Documentation/*.txt\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -29,16 +29,19 @@ INSTALL=install\n # yourself - yes, all 6 characters of it!\n #\n \n-all: html man\n+all: html txt man\n \n html: $(DOC_HTML)\n \n+txt: txt1 txt7\n+txt1: $(MAN1_TXT)\n+txt7: $(MAN7_TXT)\n \n man: man1 man7\n man1: $(DOC_MAN1)\n man7: $(DOC_MAN7)\n \n-install: man\n+install: man txt\n \t$(INSTALL) -m755 -d $(DESTDIR)/$(txtdir)\n \t$(INSTALL) $(MAN1_TXT) $(MAN7_TXT) $(DESTDIR)/$(txtdir)\n \t$(INSTALL) -m755 -d $(DESTDIR)/$(man1) $(DESTDIR)/$(man7)\n"},{"id":"8011","messageId":"20050902103128.24918.77004.stgit@zion.home.lan","threadId":"1716","inReplyTo":"20050902103125.24918.905.stgit@zion.home.lan","subject":"[PATCH 2/4] Fix cg-{diff,mkpatch} with HEAD^","fromName":"Paolo 'Blaisorblade' Giarrusso","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-09-02T10:31:30Z","receivedAt":"2005-09-02T10:31:30Z","isPatch":true,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"Supplying \"HEAD^\" to commit-id gives a failure; I saw this with the failure of:\n\n$ cg-mkpatch -r HEAD^:HEAD\n\nI wonder whether we should remove commit-id and switch to git-rev-parse\nentirely, but in the meanwhile, fix it.\n\nThe problems are two ones:\n*) there's an extra space at the end of the return string of cg-Xnormid.\n\nVerify by running the command:\necho \"\\\"$normid\\\"\"\n\n*) the space remotion in commit-id can remove only one space, and forgets\nthat when calling git-cat-file -t.\n\nFixing either one is sufficient, but I've decided to fix both.\n\nAlso, when doing cg-diff -r HEAD^:HEAD, I've noticed that tree-id has the\nsame problems, and fixed it too.\nI checked parent-id, and it's safe.\n\nFIXME: I didn't add a testcase in the t/ directory.\n\nSigned-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>\n---\n\n cg-Xnormid |    4 +++-\n commit-id  |   13 +++++++++++--\n tree-id    |   13 +++++++++++--\n 3 files changed, 25 insertions(+), 5 deletions(-)\n\ndiff --git a/cg-Xnormid b/cg-Xnormid\n--- a/cg-Xnormid\n+++ b/cg-Xnormid\n@@ -11,6 +11,8 @@\n # \tshort SHA1 (4 or more hex digits)\n #\n # Takes the ID to normalize and returns the normalized ID.\n+# Output format:\n+# 40 hex digits ID, followed by _one_ space, followed by the optional ID type.\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n@@ -19,7 +21,7 @@ id=\"$1\"\n if [ \"${id:(-1):1}\" = \"^\" ]; then\n \t# parent-id\n \tid=$(commit-id \"${id%^}\") || exit 1\n-\tgit-cat-file commit \"$id\" | awk '/^parent/{print $2,\" \"};/^$/{exit}' || exit 1\n+\tgit-cat-file commit \"$id\" | awk '/^parent/{print $2 \" \"};/^$/{exit}' || exit 1\n \texit\n fi\n \ndiff --git a/commit-id b/commit-id\n--- a/commit-id\n+++ b/commit-id\n@@ -9,8 +9,17 @@\n \n id=\"$1\"\n normid=$(. ${COGITO_LIB}cg-Xnormid \"$id\") || exit 1\n-type=${normid#* }; [ \"$type\" ] || type=$(git-cat-file -t \"$normid\")\n-normid=${normid% *}\n+# Trim beginning space; leave end one because it means we must get the type\n+# ourselves.\n+normid=${normid# }\n+type=${normid#* }\n+#Trim type.\n+type=${type# }\n+type=${type% }\n+# Trim end space (and everything after the space) when passing to\n+# git-cat-file\n+normid=${normid%% *}\n+[ \"$type\" ] || type=$(git-cat-file -t \"$normid\")\n \n if [ \"$type\" != \"commit\" ]; then\n \techo \"Invalid commit id: $normid\" >&2\ndiff --git a/tree-id b/tree-id\n--- a/tree-id\n+++ b/tree-id\n@@ -7,8 +7,17 @@\n \n id=\"$1\"\n normid=$(. ${COGITO_LIB}cg-Xnormid \"$id\") || exit 1\n-type=${normid#* }; [ \"$type\" ] || type=$(git-cat-file -t \"$normid\")\n-normid=${normid% *}\n+# Trim beginning space; leave end one because it means we must get the type\n+# ourselves.\n+normid=${normid# }\n+type=${normid#* }\n+#Trim type.\n+type=${type# }\n+type=${type% }\n+# Trim end space (and everything after the space) when passing to\n+# git-cat-file\n+normid=${normid%% *}\n+[ \"$type\" ] || type=$(git-cat-file -t \"$normid\")\n \n if [ \"$type\" = \"commit\" ]; then\n \tnormid=$(git-cat-file commit \"$normid\" | sed -e 's/tree //;q')\n"},{"id":"8014","messageId":"20050902103133.24918.46625.stgit@zion.home.lan","threadId":"1716","inReplyTo":"20050902103125.24918.905.stgit@zion.home.lan","subject":"[PATCH 3/4] commit-id micro cleanup","fromName":"Paolo 'Blaisorblade' Giarrusso","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-09-02T10:31:33Z","receivedAt":"2005-09-02T10:31:33Z","isPatch":true,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"Resync commit-id and tree-id: cg-Xlib is not needed in either.\n\nSigned-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>\n---\n\n commit-id |    2 --\n 1 files changed, 0 insertions(+), 2 deletions(-)\n\ndiff --git a/commit-id b/commit-id\n--- a/commit-id\n+++ b/commit-id\n@@ -5,8 +5,6 @@\n #\n # Takes the appropriate ID, defaults to HEAD.\n \n-. ${COGITO_LIB}cg-Xlib\n-\n id=\"$1\"\n normid=$(. ${COGITO_LIB}cg-Xnormid \"$id\") || exit 1\n # Trim beginning space; leave end one because it means we must get the type\n"},{"id":"8013","messageId":"20050902103135.24918.7990.stgit@zion.home.lan","threadId":"1716","inReplyTo":"20050902103125.24918.905.stgit@zion.home.lan","subject":"[PATCH 4/4] cg-{diff,mkpatch}: rename/copy optional detection","fromName":"Paolo 'Blaisorblade' Giarrusso","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-09-02T10:31:38Z","receivedAt":"2005-09-02T10:31:38Z","isPatch":true,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"Add -B, -M and -C options to detect content rewrites, renames and changes\nto cg-diff and cg-mkpatch, to be passed right down to git-diff-*.\nI've not added a way to pass down any option, since not everything may make\nsense, and a shell script colorizing --name-only-z output would not play so\nnice (and I mean \"unreliable behaviour\" - not tested obviously).\n\nSigned-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>\n---\n\n cg-diff    |   17 +++++++++++++++--\n cg-mkpatch |   15 ++++++++++++++-\n 2 files changed, 29 insertions(+), 3 deletions(-)\n\ndiff --git a/cg-diff b/cg-diff\n--- a/cg-diff\n+++ b/cg-diff\n@@ -28,6 +28,12 @@\n #\tBase the diff at the merge base of the -r arguments (defaulting\n #\tto HEAD and origin).\n #\n+# -M::\n+# -C::\n+# -B::\n+#\tPassed down to git-diff-*, to mean respectively \"detect renames\",\n+#\t\"detect copies\", \"detect file rewriting\".\n+#\n # ENVIRONMENT VARIABLES\n # ---------------------\n # PAGER::\n@@ -92,6 +98,7 @@ id2=\" \"\n parent=\n opt_color=\n mergebase=\n+gitflags=\n \n while optparse; do\n \tif optparse -c; then\n@@ -115,6 +122,12 @@ while optparse; do\n \t\tfi\n \telif optparse -m; then\n \t\tmergebase=1\n+\telif optparse -M; then\n+\t\tgitflags=\"$gitflags -M\"\n+\telif optparse -C; then\n+\t\tgitflags=\"$gitflags -C\"\n+\telif optparse -B; then\n+\t\tgitflags=\"$gitflags -B\"\n \telse\n \t\toptfail\n \tfi\n@@ -155,7 +168,7 @@ if [ \"$id2\" = \" \" ]; then\n \t# FIXME: Update ret based on what did we match. And take \"$@\"\n \t# to account after all.\n \tret=\n-\tcat $filter | xargs git-diff-cache -r -p $tree | colorize | pager\n+\tcat $filter | xargs git-diff-cache $gitflags -r -p $tree | colorize | pager\n \n \trm $filter\n \n@@ -169,7 +182,7 @@ id2=$(tree-id \"$id2\") || exit 1\n \n [ \"$id1\" = \"$id2\" ] && die \"trying to diff $id1 against itself\"\n \n-cat $filter | xargs git-diff-tree -r -p $id1 $id2 | colorize | pager\n+cat $filter | xargs git-diff-tree $gitflags -r -p $id1 $id2 | colorize | pager\n \n rm $filter\n exit 0\ndiff --git a/cg-mkpatch b/cg-mkpatch\n--- a/cg-mkpatch\n+++ b/cg-mkpatch\n@@ -22,6 +22,12 @@\n # -m::\n #\tBase the patches at the merge base of the -r arguments\n #\t(defaulting to HEAD and origin).\n+\n+# -M::\n+# -C::\n+# -B::\n+#\tPassed down to git-diff-*, to mean respectively \"detect renames\",\n+#\t\"detect copies\", \"detect file rewriting\".\n #\n # EXAMPLE USAGE\n # -------------\n@@ -45,7 +51,7 @@ showpatch()\n \theader=$(mktemp -t gitpatch.XXXXXX)\n \tpatch=$(mktemp -t gitpatch.XXXXXX)\n \tid=$1\n-\tcg-diff -p -r $id >$patch\n+\tcg-diff $gitflags -p -r $id >$patch\n \tgit-cat-file commit $id | while read key rest; do\n \t\tcase \"$key\" in\n \t\t\"author\"|\"committer\")\n@@ -81,6 +87,7 @@ omit_header=\n log_start=\n log_end=\n mergebase=\n+gitflags=\n \n while optparse; do\n \tif optparse -s; then\n@@ -101,6 +108,12 @@ while optparse; do\n \t\tfi\n \telif optparse -m; then\n \t\tmergebase=1\n+\telif optparse -M; then\n+\t\tgitflags=\"$gitflags -M\"\n+\telif optparse -C; then\n+\t\tgitflags=\"$gitflags -C\"\n+\telif optparse -B; then\n+\t\tgitflags=\"$gitflags -B\"\n \telse\n \t\toptfail\n \tfi\n"},{"id":"8347","messageId":"20050912004502.GH15630@pasky.or.cz","threadId":"1716","inReplyTo":"20050902103135.24918.7990.stgit@zion.home.lan","subject":"Re: [PATCH 4/4] cg-{diff,mkpatch}: rename/copy optional detection","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-09-12T00:45:02Z","receivedAt":"2005-09-12T00:45:02Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Sep 02, 2005 at 12:31:38PM CEST, I got a letter\nwhere Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> told me that...\n> Add -B, -M and -C options to detect content rewrites, renames and changes\n> to cg-diff and cg-mkpatch, to be passed right down to git-diff-*.\n> I've not added a way to pass down any option, since not everything may make\n> sense, and a shell script colorizing --name-only-z output would not play so\n> nice (and I mean \"unreliable behaviour\" - not tested obviously).\n\nWhat about just by default doing full-blown detection, with an optional\nflag to do no detection (to produce patch-compatible diffs)? I don't\nthink Cogito users usually need a more fine-tuned settings.\n\nObviously in that case we also have to fix cg-patch to process renames\nand stuff - but we should do that anyway. :-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nIf you want the holes in your knowledge showing up try teaching\nsomeone.  -- Alan Cox\n"},{"id":"8472","messageId":"200509131941.26001.blaisorblade@yahoo.it","threadId":"1716","inReplyTo":"20050912004502.GH15630@pasky.or.cz","subject":"Re: [PATCH 4/4] cg-{diff,mkpatch}: rename/copy optional detection","fromName":"Blaisorblade","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-09-13T17:41:24Z","receivedAt":"2005-09-13T17:41:24Z","isPatch":true,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"On Monday 12 September 2005 02:45, Petr Baudis wrote:\n> Dear diary, on Fri, Sep 02, 2005 at 12:31:38PM CEST, I got a letter\n> where Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> told me\n> that...\n>\n> > Add -B, -M and -C options to detect content rewrites, renames and changes\n> > to cg-diff and cg-mkpatch, to be passed right down to git-diff-*.\n> > I've not added a way to pass down any option, since not everything may\n> > make sense, and a shell script colorizing --name-only-z output would not\n> > play so nice (and I mean \"unreliable behaviour\" - not tested obviously).\n>\n> What about just by default doing full-blown detection, with an optional\n> flag to do no detection (to produce patch-compatible diffs)? I don't\n> think Cogito users usually need a more fine-tuned settings.\nNo problem for me, as long git is fast enough in handling that (guess yes).\n> Obviously in that case we also have to fix cg-patch to process renames\n> and stuff - but we should do that anyway. :-)\n\n-- \nInform me of my mistakes, so I can keep imitating Homer Simpson's \"Doh!\".\nPaolo Giarrusso, aka Blaisorblade (Skype ID \"PaoloGiarrusso\", ICQ 215621894)\nhttp://www.user-mode-linux.org/~blaisorblade\n\n\t\n\n\t\n\t\t\n___________________________________ \nYahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB \nhttp://mail.yahoo.it\n"}]}