* Re: Checking for fast-forward [not found] <ca4f67be0907060936v7bf7c44y4395717fff854fd4@mail.gmail.com> @ 2009-07-06 21:26 ` Florian Mickler 2009-07-07 8:21 ` Michael J Gruber 0 siblings, 1 reply; 5+ messages in thread From: Florian Mickler @ 2009-07-06 21:26 UTC (permalink / raw) To: Lee Griffiths; +Cc: git this is more of a git question, than smth special to msysgit. (git ml cc'd) On Mon, 6 Jul 2009 17:36:54 +0100 Lee Griffiths <poddster@gmail.com> wrote: > > I have a script that checks for fast-forwarding by doing a git push > --dry-run. This strikes me as the wrong way to do it as it does _all_ > of the stuff a git push would normally do i.e., packing and so on, and > I'm only really after the fast-forward check. Seeing as I already do a > git push at the end of the script (actualy two, as I do a --tags one > as well[1]), it seems like a big waste of time. Is there anyother way > to check and see if the git push would work? (I want the script to > avoid doing a git pull if possible). > > > Thanks, > Lee > > > > [1] I originally assumed --tags would push the data AND the tags, but > that doesn't seem to be the case.... Am I wrong in this? > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Checking for fast-forward 2009-07-06 21:26 ` Checking for fast-forward Florian Mickler @ 2009-07-07 8:21 ` Michael J Gruber 2009-07-07 10:46 ` Florian Mickler 2009-07-08 17:36 ` Lee Griffiths 0 siblings, 2 replies; 5+ messages in thread From: Michael J Gruber @ 2009-07-07 8:21 UTC (permalink / raw) To: Florian Mickler; +Cc: Lee Griffiths, git Florian Mickler venit, vidit, dixit 06.07.2009 23:26: > this is more of a git question, than smth special to msysgit. > > (git ml cc'd) > > On Mon, 6 Jul 2009 17:36:54 +0100 > Lee Griffiths <poddster@gmail.com> wrote: > >> >> I have a script that checks for fast-forwarding by doing a git push >> --dry-run. This strikes me as the wrong way to do it as it does _all_ >> of the stuff a git push would normally do i.e., packing and so on, and >> I'm only really after the fast-forward check. Seeing as I already do a >> git push at the end of the script (actualy two, as I do a --tags one >> as well[1]), it seems like a big waste of time. Is there anyother way >> to check and see if the git push would work? (I want the script to >> avoid doing a git pull if possible). No. (I infer your question is how to find out whether a push is a fast-forward.) If you don't know the state of the branch head in the remote repo you simply cannot know whether the push will be a fast-forward. If you know that your corresponding remote branch (say remotes/origin/foo) is up-to-date with the destination branch (say foo) in the remote repo (e.g., because you know you've fetched before and nobody else is allowed to push there) then you can compare your branch to be pushed (say foo) with your remote branch: If $(git rev-list bar..remotes/origin/foo) is empty then the branch foo in the remote repo can be fast-forwarded to bar. Chhers, Michael ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Checking for fast-forward 2009-07-07 8:21 ` Michael J Gruber @ 2009-07-07 10:46 ` Florian Mickler 2009-07-07 11:01 ` Michael J Gruber 2009-07-08 17:36 ` Lee Griffiths 1 sibling, 1 reply; 5+ messages in thread From: Florian Mickler @ 2009-07-07 10:46 UTC (permalink / raw) To: Michael J Gruber; +Cc: Lee Griffiths, git [-- Attachment #1: Type: text/plain, Size: 400 bytes --] On Tue, 07 Jul 2009 10:21:40 +0200 Michael J Gruber <git@drmicha.warpmail.net> wrote: > If $(git rev-list bar..remotes/origin/foo) is empty then the branch > foo in the remote repo can be fast-forwarded to bar. > > Chhers, > Michael in that case you could also do 'git cherry bar origin/foo' that shows you all commits that are in origin/foo but not in bar. Sincerely, Florian [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Checking for fast-forward 2009-07-07 10:46 ` Florian Mickler @ 2009-07-07 11:01 ` Michael J Gruber 0 siblings, 0 replies; 5+ messages in thread From: Michael J Gruber @ 2009-07-07 11:01 UTC (permalink / raw) To: Florian Mickler; +Cc: Michael J Gruber, Lee Griffiths, git Florian Mickler venit, vidit, dixit 07.07.2009 12:46: > On Tue, 07 Jul 2009 10:21:40 +0200 > Michael J Gruber <git@drmicha.warpmail.net> wrote: > >> If $(git rev-list bar..remotes/origin/foo) is empty then the branch >> foo in the remote repo can be fast-forwarded to bar. >> >> Chhers, >> Michael > > in that case you could also do > 'git cherry bar origin/foo' > > that shows you all commits that are in origin/foo but not in bar. Well, that goes through all commits "bar..remotes/origin/foo" and computes patch-ids. It is porcelain. Don't use it for scripting. Michael ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Checking for fast-forward 2009-07-07 8:21 ` Michael J Gruber 2009-07-07 10:46 ` Florian Mickler @ 2009-07-08 17:36 ` Lee Griffiths 1 sibling, 0 replies; 5+ messages in thread From: Lee Griffiths @ 2009-07-08 17:36 UTC (permalink / raw) To: Michael J Gruber; +Cc: Florian Mickler, git Thanks for the answers :) After seeing that git push skips the packing (and potentially other things) when doing a dry run, and given that: git push --dry-run takes 1.5s on average and that: git fetch git rev-list master..remotes/origin/master OR git ls-remote origin refs/remotes/origin/master take 4s on average, I think I'll stick with the dry-run & checking for exception method. Thanks though :) 2009/7/7 Michael J Gruber <git@drmicha.warpmail.net>: > If $(git rev-list bar..remotes/origin/foo) is empty then the branch foo > in the remote repo can be fast-forwarded to bar. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-08 17:37 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <ca4f67be0907060936v7bf7c44y4395717fff854fd4@mail.gmail.com> 2009-07-06 21:26 ` Checking for fast-forward Florian Mickler 2009-07-07 8:21 ` Michael J Gruber 2009-07-07 10:46 ` Florian Mickler 2009-07-07 11:01 ` Michael J Gruber 2009-07-08 17:36 ` Lee Griffiths
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).