Re: [PATCH] Enable git rev-list to parse --quiet
From: Nick Andrew <hidden>
Date: 2016-06-15 22:44:58
On Thu, Jul 17, 2008 at 10:42:21PM -0700, Junio C Hamano wrote:
Thanks for noticing, but this replaces one breakage with another. Your new behaviour is a new "tell me if it is an empty set" option, and it means quite different thing from what --quiet does.
Fair enough. Yes, I want to find out if it is an empty set. The manpage does say "fully connected" which I interpreted to mean that one set of commits is a subset of the other.. I want to automatically (e.g. in crontab) update a git repo to the latest HEAD from a remote branch ... but with the possibility that the local repo has local changes, and I want no chance of merge failure. In other words, "git fetch remote; git merge origin/master" and only do the merge if it's a fast-forward. If there are any local commits, or local uncommitted changes, then leave the local working tree alone. So my idea was to use "git rev-list --quiet master ^origin/master" and check the exit code; if zero do "git merge origin/master". Without a working "--quiet" nor exit code I can pipe the output to "wc -l" but is there a more efficient/reliable way to implement the requirement? Nick.