{"thread":{"id":"30883","subject":"checking for 'clean' bare repo before push","startedAt":"2012-06-24T10:21:49Z","lastAt":"2012-06-25T05:35:51Z","messageCount":2,"participants":["Neal Kreitzinger","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"194151","messageId":"js6pnt$28f$1@dough.gmane.org","threadId":"30883","inReplyTo":null,"subject":"checking for 'clean' bare repo before push","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2012-06-24T10:21:49Z","receivedAt":"2012-06-24T10:21:49Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"I'm being asked to provide commands to check for 'clean' state of bare \nrepo before and after a git-push.  This request is based on the notion \nof checking for a clean worktree (git status) before a checkout, merge, \netc on a non-bare repo and checking the worktree state after such \noperations.\n\nContext:\nSince the bare repo and non-bare clone repos in question only have \nbranch master, and deny-non-ff is set for the bare repo, I don't think \nthere are checks to be done before and after git-push in our case. \ngit-gc and git-fsck could be possible, but don't seem normative for \nevery single push.  git-gc has auto configurations, and git fsck is \nexpensive.  It seems like routine git-gc obviates the need for git fsck.\n\nAm I correct on this?\n\nv/r,\nneal\n"},{"id":"194177","messageId":"7vk3ywhs20.fsf@alter.siamese.dyndns.org","threadId":"30883","inReplyTo":"js6pnt$28f$1@dough.gmane.org","subject":"Re: checking for 'clean' bare repo before push","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-25T05:35:51Z","receivedAt":"2012-06-25T05:35:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Neal Kreitzinger <nkreitzinger@gmail.com> writes:\n\n> I'm being asked to provide commands to check for 'clean' state of bare\n> repo before and after a git-push.  This request is based on the notion\n> of checking for a clean worktree (git status) before a checkout,\n> merge, etc on a non-bare repo and checking the worktree state after\n> such operations.\n>\n> Context:\n> Since the bare repo and non-bare clone repos in question only have\n> branch master, and deny-non-ff is set for the bare repo, I don't think\n> there are checks to be done before and after git-push in our\n> case. git-gc and git-fsck could be possible, but don't seem normative\n> for every single push.  git-gc has auto configurations, and git fsck\n> is expensive.  It seems like routine git-gc obviates the need for git\n> fsck.\n>\n> Am I correct on this?\n\nI agree 100% with you that it is entirely unclear what 'clean'-ness\nyour requestor wants from your description.\n\nAt a higher conceptual level, \"before I do merge I want to check if\nthe working tree is clean\" is a wish to avoid \"overwriting\" things,\nand in that sense, perhaps the requestor wants to make sure that a\npush she accepts does not overwrite somebody else's work.\n\nSuch a 'clean'ness is called \"fast-forward\", and by default a push\nhas to be a fast-forward to be accepted.  The pusher can \"force\" a\npush that is not fast-forward, but there is a way to forbid such a\nforced push (receive.denyNonFastForwards).\n"}]}