{"thread":{"id":"7453","subject":"[PATCH] bisect: use update-ref to update refs","startedAt":"2007-03-28T12:35:20Z","lastAt":"2007-03-28T14:10:23Z","messageCount":3,"participants":["Uwe Kleine-König","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"38250","messageId":"20070328123519.GA4472@cepheus","threadId":"7453","inReplyTo":null,"subject":"[PATCH] bisect: use update-ref to update refs","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@informatik.uni-freiburg.de","sentAt":"2007-03-28T12:35:20Z","receivedAt":"2007-03-28T12:35:20Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"update-ref is safer than manualy echoing values to various files in\n$GIT_DIR/refs/heads/.\n\nbisect predates update-ref and was never updated to use the latter.\n\nSigned-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>\n---\n\nThere are some style nits in git-bisect.sh that I found while producing that\npatch.  E.g. the 3rd hunk shows \n\n\tGIT_DIR=\"$GIT_DIR\" git-$command ...\n\nwhere the assignment to GIT_DIR should be superfluous?  In some places\ngit-command is used, and in other git command.\n\n git-bisect.sh |   13 +++++++------\n 1 files changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex a12ea31..1589870 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -90,7 +90,7 @@ bisect_bad() {\n \t*)\n \t\tusage ;;\n \tesac || exit\n-\techo \"$rev\" >\"$GIT_DIR/refs/bisect/bad\"\n+\tgit update-ref \"refs/bisect/bad\" \"$rev\"\n \techo \"# bad: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n \techo \"git-bisect bad $rev\" >>\"$GIT_DIR/BISECT_LOG\"\n \tbisect_auto_next\n@@ -106,7 +106,7 @@ bisect_good() {\n \tfor rev in $revs\n \tdo\n \t\trev=$(git-rev-parse --verify \"$rev^{commit}\") || exit\n-\t\techo \"$rev\" >\"$GIT_DIR/refs/bisect/good-$rev\"\n+\t\tgit update-ref \"refs/bisect/good-$rev\" \"$rev\"\n \t\techo \"# good: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n \t\techo \"git-bisect good $rev\" >>\"$GIT_DIR/BISECT_LOG\"\n \tdone\n@@ -159,9 +159,10 @@ bisect_next() {\n \t\tnr=\"$nr_good\";\n \tfi;\n \techo \"Bisecting: maximal $nr revisions left to test\"\n-\techo \"$rev\" > \"$GIT_DIR/refs/heads/new-bisect\"\n+\tgit update-ref refs/heads/new-bisect \"$rev\"\n \tgit checkout -q new-bisect || exit\n-\tmv \"$GIT_DIR/refs/heads/new-bisect\" \"$GIT_DIR/refs/heads/bisect\" &&\n+\tgit update-ref refs/heads/bisect \"$rev\" &&\n+\tgit update-ref -d refs/heads/new-bisect \"$rev\" &&\n \tGIT_DIR=\"$GIT_DIR\" git-symbolic-ref HEAD refs/heads/bisect\n \tgit-show-branch \"$rev\"\n }\n@@ -211,12 +212,12 @@ bisect_replay () {\n \t\t\teval \"$cmd\"\n \t\t\t;;\n \t\tgood)\n-\t\t\techo \"$rev\" >\"$GIT_DIR/refs/bisect/good-$rev\"\n+\t\t\tgit update-ref \"refs/bisect/good-$rev\" \"$rev\"\n \t\t\techo \"# good: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n \t\t\techo \"git-bisect good $rev\" >>\"$GIT_DIR/BISECT_LOG\"\n \t\t\t;;\n \t\tbad)\n-\t\t\techo \"$rev\" >\"$GIT_DIR/refs/bisect/bad\"\n+\t\t\tgit update-ref \"refs/bisect/bad\" \"$rev\"\n \t\t\techo \"# bad: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n \t\t\techo \"git-bisect bad $rev\" >>\"$GIT_DIR/BISECT_LOG\"\n \t\t\t;;\n-- \n1.5.0.2.260.g2eb065\n\n\n-- \nUwe Kleine-König\n\nhttp://www.google.com/search?q=1+newton+in+kg*m+%2F+s%5E2\n"},{"id":"38251","messageId":"460A71A1.D1388D3@eudaptics.com","threadId":"7453","inReplyTo":"20070328123519.GA4472@cepheus","subject":"Re: [PATCH] bisect: use update-ref to update refs","fromName":"Johannes Sixt","fromEmail":"j.sixt@eudaptics.com","sentAt":"2007-03-28T13:46:09Z","receivedAt":"2007-03-28T13:46:09Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Uwe Kleine-König wrote:\n>         GIT_DIR=\"$GIT_DIR\" git-$command ...\n> \n> where the assignment to GIT_DIR should be superfluous?\n\ngit-sh-setup sets GIT_DIR, but does not export it. Therefore, this\nassignment is *not* superfluous (its effect is to export GIT_DIR for\nthis command only).\n\n-- Hannes\n"},{"id":"38252","messageId":"20070328141023.GB23378@informatik.uni-freiburg.de","threadId":"7453","inReplyTo":"460A71A1.D1388D3@eudaptics.com","subject":"Re: [PATCH] bisect: use update-ref to update refs","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@informatik.uni-freiburg.de","sentAt":"2007-03-28T14:10:23Z","receivedAt":"2007-03-28T14:10:23Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Johannes Sixt wrote:\n> Uwe Kleine-König wrote:\n> >         GIT_DIR=\"$GIT_DIR\" git-$command ...\n> > \n> > where the assignment to GIT_DIR should be superfluous?\n> \n> git-sh-setup sets GIT_DIR, but does not export it. Therefore, this\n> assignment is *not* superfluous (its effect is to export GIT_DIR for\n> this command only).\n..., but why do only two invocations of git get GIT_DIR=\"$GIT_DIR\" and\nthe other 20+ don't?\n\nBest regards\nUwe\n\n-- \nUwe Kleine-König\n\nhttp://www.google.com/search?q=sine+of+%2830+degree%29\n"}]}