merlyn@stonehenge.com (Randal L. Schwartz) writes: > Other than grep the output of the "pull" commands, I'd like to have a > flag added that will also set an exit status to "successful" if new > things were pulled. That way, I can automate a "make install" > resulting from a successful new pull, ala: > > git-pull --silent && make install How about this instead of your one-liner? old_head=$(git-rev-parse --verify HEAD) && git-pull -n >/dev/null 2>&1 || exit new_head=$(git-rev-parse --verify HEAD) test "$old_head" = "$new_head" || make test install git-pull has at least 4 different possible outcomes, and its exit code talks about its success/failure right now. 1. fetch did not succeed, so pull should result in failure. In this case there is no change in your repository, and no point rebuilding. 2. fetch contacted the other end and concluded conversation correctly. 2-a. There was no change upstream (or you were up-to-date -- the other side was behind you). This is a successful pull, but you probably do not want to rebuild. 2-b. There were changes upstream and we tried to merge. Merge was successful. This case you would want to rebuild. 2-c. There were changes upstream and automerge failed. You cannot rebuild in this case. With your proposal we should need to exit non-zero in case 2-a when we are running with --silent. This feels somewhat counter-intuitive if not wrong, even if it is only done under a particular flag. - 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.htmlReceived on Mon Oct 31 04:20:38 2005
This archive was generated by hypermail 2.1.8 : 2005-10-31 04:20:42 EST