git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* finding if a commit is needed
@ 2010-07-28  8:53 Geoff Russell
  2010-07-29  0:06 ` Jonathan Nieder
  0 siblings, 1 reply; 3+ messages in thread
From: Geoff Russell @ 2010-07-28  8:53 UTC (permalink / raw)
  To: git

We have an interface which "rolls back" commits to a previous time in
a set of data files using read-tree.

Works great ... but sometimes there are files which have
been changed in the working tree which cause read-tree to fail.
The files should have been committed but weren't.
"git read-tree -i" isn't appropriate because
we want to commit these files before the read-tree rolls
them back ... because they are changes which might be
resurrected and we don't want to lose them altogether.

So ...

       git commit -a -m "something" && git read-tree ...

Doesn't work when there are no files which need committing ...

       git commit -a -m "something" || git read-tree ...

Doesn't work when there are.

Is there something which can test whether a commit is needed?

I define "needed" as meaning when git commit -a would make a non-identical
commit.

Many thanks,
Geoff.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: finding if a commit is needed
  2010-07-28  8:53 finding if a commit is needed Geoff Russell
@ 2010-07-29  0:06 ` Jonathan Nieder
  2010-07-30 10:16   ` Geoff Russell
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2010-07-29  0:06 UTC (permalink / raw)
  To: Geoff Russell; +Cc: git

Geoff Russell wrote:

> Is there something which can test whether a commit is needed?
> 
> I define "needed" as meaning when git commit -a would make a non-identical
> commit.

Maybe "git diff --exit-code HEAD"?

Regards,
Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: finding if a commit is needed
  2010-07-29  0:06 ` Jonathan Nieder
@ 2010-07-30 10:16   ` Geoff Russell
  0 siblings, 0 replies; 3+ messages in thread
From: Geoff Russell @ 2010-07-30 10:16 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git

On Thu, Jul 29, 2010 at 9:36 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Geoff Russell wrote:
>
>> Is there something which can test whether a commit is needed?
>>
>> I define "needed" as meaning when git commit -a would make a non-identical
>> commit.
>
> Maybe "git diff --exit-code HEAD"?

Thanks ... "git diff --quiet || echo differences"

Cheers,
Geoff.

>
> Regards,
> Jonathan
>



-- 
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069
http://perfidy.com.au

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-30 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28  8:53 finding if a commit is needed Geoff Russell
2010-07-29  0:06 ` Jonathan Nieder
2010-07-30 10:16   ` Geoff Russell

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).