git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git commit (or git-commit-script) question
@ 2005-08-19 17:06 Johnny Stenback
  2005-08-19 17:36 ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Johnny Stenback @ 2005-08-19 17:06 UTC (permalink / raw)
  To: git

Hey all,

git-commit-script --help says:

git commit [-a]  [-m <message>] [-F <logfile>] [(-C|-c) <commit>] 
[<path>...]

That made me assume that if I do:

   git-commit-script somedir

it would *only* commit the changes I've made in "somedir", but it 
appears to commit *all* files that have changed (and shows all files in 
the list of changed files in the commit message it displays in the 
editor), as if it's completely ignoring the <path> argument.

Known problem? I got this using git that I pulled from kernel.org 
earlier this morning.

-- 
jst

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

* Re: git commit (or git-commit-script) question
  2005-08-19 17:06 git commit (or git-commit-script) question Johnny Stenback
@ 2005-08-19 17:36 ` Linus Torvalds
  2005-08-19 17:44   ` Johnny Stenback
  2005-08-19 19:52   ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Linus Torvalds @ 2005-08-19 17:36 UTC (permalink / raw)
  To: Johnny Stenback; +Cc: git



On Fri, 19 Aug 2005, Johnny Stenback wrote:
> 
> That made me assume that if I do:
> 
>    git-commit-script somedir
> 
> it would *only* commit the changes I've made in "somedir", but it 
> appears to commit *all* files that have changed (and shows all files in 
> the list of changed files in the commit message it displays in the 
> editor), as if it's completely ignoring the <path> argument.
> 
> Known problem? I got this using git that I pulled from kernel.org 
> earlier this morning.

It works for me. You _should_ see something like

	#
	# Updated but not checked in:
	#   (will commit)
	#
	#       modified: somedir/somefile
	#
	#
	# Changed but not updated:
	#   (use git-update-cache to mark for commit)
	#
	#	modified: otherdir/anotherfile
	#

which basically means that it will commit "somedir/somefile", but _not_ 
commit "otherdir/anotherfile".

However, one thing to look out for is that if you've marked any files for 
update (with git-update-cache) those will always be committed regardless 
of what arguments you give to "git commit". You can reset the index with 
"git reset" if you decided that you don't want to commit after all.

(For example, if you do a "git commit --all", but decide not to commit 
after all by writing an empty commit message, that will already have 
marked all the files to be committed, so next time, even if you then use 
"git commit somedir", all the files in all the _other_ dirs have already 
been marked for update, so you'll see everything being committed).

			Linus

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

* Re: git commit (or git-commit-script) question
  2005-08-19 17:36 ` Linus Torvalds
@ 2005-08-19 17:44   ` Johnny Stenback
  2005-08-19 19:52   ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Johnny Stenback @ 2005-08-19 17:44 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

Ah, that explains it. I had already marked all my changes for update, 
that's what threw me off here. Thanks!

Linus Torvalds wrote:
> 
> On Fri, 19 Aug 2005, Johnny Stenback wrote:
>> That made me assume that if I do:
>>
>>    git-commit-script somedir
>>
>> it would *only* commit the changes I've made in "somedir", but it 
>> appears to commit *all* files that have changed (and shows all files in 
>> the list of changed files in the commit message it displays in the 
>> editor), as if it's completely ignoring the <path> argument.
>>
>> Known problem? I got this using git that I pulled from kernel.org 
>> earlier this morning.
> 
> It works for me. You _should_ see something like
> 
> 	#
> 	# Updated but not checked in:
> 	#   (will commit)
> 	#
> 	#       modified: somedir/somefile
> 	#
> 	#
> 	# Changed but not updated:
> 	#   (use git-update-cache to mark for commit)
> 	#
> 	#	modified: otherdir/anotherfile
> 	#
> 
> which basically means that it will commit "somedir/somefile", but _not_ 
> commit "otherdir/anotherfile".
> 
> However, one thing to look out for is that if you've marked any files for 
> update (with git-update-cache) those will always be committed regardless 
> of what arguments you give to "git commit". You can reset the index with 
> "git reset" if you decided that you don't want to commit after all.
> 
> (For example, if you do a "git commit --all", but decide not to commit 
> after all by writing an empty commit message, that will already have 
> marked all the files to be committed, so next time, even if you then use 
> "git commit somedir", all the files in all the _other_ dirs have already 
> been marked for update, so you'll see everything being committed).
> 
> 			Linus
> -
> 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.html
> 

-- 
jst

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

* Re: git commit (or git-commit-script) question
  2005-08-19 17:36 ` Linus Torvalds
  2005-08-19 17:44   ` Johnny Stenback
@ 2005-08-19 19:52   ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2005-08-19 19:52 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

Linus Torvalds <torvalds@osdl.org> writes:

> However, one thing to look out for is that if you've marked any files for 
> update (with git-update-cache) those will always be committed regardless 
> of what arguments you give to "git commit".

Another thing to look out for is that the files you told it
about with "git add" will be included and does not show up in
"git diff", because there currently is no way to record "intent
to add" (rather, "Mr GIT, please keep an eye on this file")
without actually adding a path to the index file for inclusion
in the next commit.

I have a couple of updates to git-commit-script in the proposed
updates branch, and one of the changes is that git-update-cache
in git-commit-script, used when either the --all flag or
explicit paths are given, has a --remove flag there.  The reason
it does not need --add flag there as well is a direct
consequence of this asymmetry.

Although I do not think this asymmetry a major source of
confusion, I suspect that we could "fix" it by treating an index
entry with all-zero mode and sha1 as "keep-an-eye-on" entry with
a new flag "git-update-cache --watch <path>" or something like
that.  "git-diff-files" would then treat that special entry as a
nonexistent path and would compare it with whatever happens to
be (or lack of it) in the working tree, and "git diff" would
show a diff that creates the file.  This needs a tweak or two in
the diffcore machinery as well.

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

end of thread, other threads:[~2005-08-19 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-19 17:06 git commit (or git-commit-script) question Johnny Stenback
2005-08-19 17:36 ` Linus Torvalds
2005-08-19 17:44   ` Johnny Stenback
2005-08-19 19:52   ` Junio C Hamano

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