git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible bug with git status in 1.7.0
@ 2010-02-17 19:14 Sergio
  2010-02-17 19:21 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Sergio @ 2010-02-17 19:14 UTC (permalink / raw)
  To: git

Hi,

if you have a submodule and the submodule contains
untracked files, "git status" in 1.7.0 keeps showing
the module as modified.

But of of course it is useless to "git add" the module
or to try to "git  commit -a", since the index entry is ok

I do not know if this is an intended behavior, but it
looks different from 1.6.6.1.

Sergio

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

* Re: Possible bug with git status in 1.7.0
  2010-02-17 19:14 Possible bug with git status in 1.7.0 Sergio
@ 2010-02-17 19:21 ` Junio C Hamano
  2010-02-17 19:52   ` Sergio Callegari
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2010-02-17 19:21 UTC (permalink / raw)
  To: Sergio; +Cc: git

Sergio <sergio.callegari@gmail.com> writes:

> if you have a submodule and the submodule contains
> untracked files, "git status" in 1.7.0 keeps showing
> the module as modified.
>
> But of of course it is useless to "git add" the module
> or to try to "git  commit -a", since the index entry is ok

Of course it is useless to "git add" in the superproject, and this is
an intended bugfix.

You are getting reminded that you either forgot to "git add" that file in
the submodule, or you forgot to add that file to .gitignore in the
submodule.

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

* Re: Possible bug with git status in 1.7.0
  2010-02-17 19:21 ` Junio C Hamano
@ 2010-02-17 19:52   ` Sergio Callegari
  2010-02-17 20:52     ` Jens Lehmann
  0 siblings, 1 reply; 7+ messages in thread
From: Sergio Callegari @ 2010-02-17 19:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> Sergio <sergio.callegari@gmail.com> writes:
>
>   
>> if you have a submodule and the submodule contains
>> untracked files, "git status" in 1.7.0 keeps showing
>> the module as modified.
>>
>> But of of course it is useless to "git add" the module
>> or to try to "git  commit -a", since the index entry is ok
>>     
>
> Of course it is useless to "git add" in the superproject, and this is
> an intended bugfix.
>
> You are getting reminded that you either forgot to "git add" that file in
> the submodule, or you forgot to add that file to .gitignore in the
> submodule.
>   

Thanks for the explanation!

The wording of the reminder is a bit unclear, though.  Suppose that the 
problem is with submodule "mod".

What you get from git status is a notice that something is modified but 
not updated, with the following suggestion

# Changed but not 
updated:                                                                                      

#   (use "git add <file>..." to update what will be committed)

and then the notice about what is in fact modified

#       modified:   mod


So the first problem is that now git status provides a hint that may be 
confusing.  One gets the idea that he needs to add mod (to store a new 
commit id in the index) and not to add a file in mod.


As a second issue, note that mod is in fact not really modified being that

1) no tracked file in it has been modified.
2) no new commit has been made

and the fact is that from git status I cannot recognize anymore if the 
module is really changed (the module commit id has changed) or has 
uncommited changes (some tracked file is changed) or is merely polluted 
by untracked files, so now I always need to explore the submodule.

It is true that this can be solved putting more stuff in .gitignore.
However, it might be a matter of taste, but I do not like putting all 
byproducts in .gitignore  because not doing so allows me to 
differentiate between

- files that are just garbage
- files that are not tracked but may be still precious

and selectively clean either category using the -x or -X options of git 
clean.


So, it would be nice to improve the feedback of git status for this 
particular case and possibly have an option to avoid status being so 
wordy about untracked files.


Sergio

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

* Re: Possible bug with git status in 1.7.0
  2010-02-17 19:52   ` Sergio Callegari
@ 2010-02-17 20:52     ` Jens Lehmann
  2010-02-19 16:42       ` Sergio Callegari
  0 siblings, 1 reply; 7+ messages in thread
From: Jens Lehmann @ 2010-02-17 20:52 UTC (permalink / raw)
  To: Sergio Callegari; +Cc: Junio C Hamano, git

Am 17.02.2010 20:52, schrieb Sergio Callegari:
> Junio C Hamano wrote:
>> You are getting reminded that you either forgot to "git add" that file in
>> the submodule, or you forgot to add that file to .gitignore in the
>> submodule.
>>   
> 
> Thanks for the explanation!
> 
> The wording of the reminder is a bit unclear, though.  Suppose that the
> problem is with submodule "mod".
> 
> What you get from git status is a notice that something is modified but
> not updated, with the following suggestion
> 
> # Changed but not
> updated:                                                                                     
> 
> #   (use "git add <file>..." to update what will be committed)
> 
> and then the notice about what is in fact modified
> 
> #       modified:   mod
> 
> 
> So the first problem is that now git status provides a hint that may be
> confusing.  One gets the idea that he needs to add mod (to store a new
> commit id in the index) and not to add a file in mod.

That is a very valid point. I am currently working on git status being
more explicit about the type of modification. I just asked for comments
on this issue on February 14th in the thread titled "[PATCH/RFC] git
diff --submodule: Show detailed dirty status of submodules" (Gmane is
down for me right now, so i am sorry: no link today).

The changes i have in mind for git status would also include giving a
better hint, as you rightfully pointed out.


> As a second issue, note that mod is in fact not really modified being that
> 
> 1) no tracked file in it has been modified.
> 2) no new commit has been made
> 
> and the fact is that from git status I cannot recognize anymore if the
> module is really changed (the module commit id has changed) or has
> uncommited changes (some tracked file is changed) or is merely polluted
> by untracked files, so now I always need to explore the submodule.
> 
> It is true that this can be solved putting more stuff in .gitignore.
> However, it might be a matter of taste, but I do not like putting all
> byproducts in .gitignore  because not doing so allows me to
> differentiate between
> 
> - files that are just garbage
> - files that are not tracked but may be still precious
> 
> and selectively clean either category using the -x or -X options of git
> clean.
> 
> 
> So, it would be nice to improve the feedback of git status for this
> particular case and possibly have an option to avoid status being so
> wordy about untracked files.

So i assume that my proposal to explicitly state that a submodule has
new commits, modified files and/or untracked files would solve your
woes?

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

* Re: Possible bug with git status in 1.7.0
  2010-02-17 20:52     ` Jens Lehmann
@ 2010-02-19 16:42       ` Sergio Callegari
  2010-02-19 20:55         ` Jens Lehmann
  0 siblings, 1 reply; 7+ messages in thread
From: Sergio Callegari @ 2010-02-19 16:42 UTC (permalink / raw)
  To: Jens Lehmann; +Cc: Junio C Hamano, git

Jens Lehmann wrote:
>> The wording of the reminder is a bit unclear, though.  Suppose that the
>> problem is with submodule "mod".
>>
>> What you get from git status is a notice that something is modified but
>> not updated, with the following suggestion
>>
>> # Changed but not
>> updated:                                                                                     
>>
>> #   (use "git add <file>..." to update what will be committed)
>>
>> and then the notice about what is in fact modified
>>
>> #       modified:   mod
>>
>>
>> So the first problem is that now git status provides a hint that may be
>> confusing.  One gets the idea that he needs to add mod (to store a new
>> commit id in the index) and not to add a file in mod.
>>     
>
> That is a very valid point. I am currently working on git status being
> more explicit about the type of modification. I just asked for comments
> on this issue on February 14th in the thread titled "[PATCH/RFC] git
> diff --submodule: Show detailed dirty status of submodules" (Gmane is
> down for me right now, so i am sorry: no link today).
>
> The changes i have in mind for git status would also include giving a
> better hint, as you rightfully pointed out.
>   
Missed that, thanks for pointing out
>> As a second issue, note that mod is in fact not really modified being that
>>
>> 1) no tracked file in it has been modified.
>> 2) no new commit has been made
>>
>> and the fact is that from git status I cannot recognize anymore if the
>> module is really changed (the module commit id has changed) or has
>> uncommited changes (some tracked file is changed) or is merely polluted
>> by untracked files, so now I always need to explore the submodule.
>>
>> It is true that this can be solved putting more stuff in .gitignore.
>> However, it might be a matter of taste, but I do not like putting all
>> byproducts in .gitignore  because not doing so allows me to
>> differentiate between
>>
>> - files that are just garbage
>> - files that are not tracked but may be still precious
>>
>> and selectively clean either category using the -x or -X options of git
>> clean.
>>
>>
>> So, it would be nice to improve the feedback of git status for this
>> particular case and possibly have an option to avoid status being so
>> wordy about untracked files.
>>     
>
> So i assume that my proposal to explicitly state that a submodule has
> new commits, modified files and/or untracked files would solve your
> woes?
>   

Yes! My ideal behavior (if I am not asking too much) would be trying to 
keep the status as little wordy as possible (1 line per submodule)

e.g. something like

#       modified module (commit id):   mod1
#       modified module (modified files): mod2
#	modified module (untracked files): mod3
#       modified module (modified files, untracked files): mod4
#	modified module (commit id, modified files, untracked files): mod5

and with an option to avoid complaining about untracked files in the 
submodules

e.g. if option is not selected, entry about mod3 would not be printed at 
all.


And of course it would be useful to modify the suggestions into 
something like

#   (use "git add <file>/<submodule>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (enter modules that have modified/untracked files to perform actions on them) 


Thanks,

Sergio

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

* Re: Possible bug with git status in 1.7.0
  2010-02-19 16:42       ` Sergio Callegari
@ 2010-02-19 20:55         ` Jens Lehmann
  2010-02-20 11:05           ` Sergio Callegari
  0 siblings, 1 reply; 7+ messages in thread
From: Jens Lehmann @ 2010-02-19 20:55 UTC (permalink / raw)
  To: Sergio Callegari; +Cc: Junio C Hamano, git

Am 19.02.2010 17:42, schrieb Sergio Callegari:
> Yes! My ideal behavior (if I am not asking too much) would be trying to
> keep the status as little wordy as possible (1 line per submodule)
> 
> e.g. something like
> 
> #       modified module (commit id):   mod1
> #       modified module (modified files): mod2
> #    modified module (untracked files): mod3
> #       modified module (modified files, untracked files): mod4
> #    modified module (commit id, modified files, untracked files): mod5

Yup, one line per submodule should be enough. But maybe it's nicer to
have the details /after/ the submodule name:

#	modified:   mod1 (Submodule has new commit(s), modified content, untracked content)

Then it fits more nicely with the output for files, no?

We could drop the "Submodule has " if people see it as a waste of screen
estate. Also i have no strong feelings about "content", i just happen to
think it is more appropriate as submodules can contain not only files but
other submodules too. Opinions?

Will send a patch for discussion as soon as i have something to show ...

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

* Re: Possible bug with git status in 1.7.0
  2010-02-19 20:55         ` Jens Lehmann
@ 2010-02-20 11:05           ` Sergio Callegari
  0 siblings, 0 replies; 7+ messages in thread
From: Sergio Callegari @ 2010-02-20 11:05 UTC (permalink / raw)
  To: Jens Lehmann; +Cc: Junio C Hamano, git

Jens Lehmann wrote:
> Yup, one line per submodule should be enough. But maybe it's nicer to
> have the details /after/ the submodule name:
>
> #	modified:   mod1 (Submodule has new commit(s), modified content, untracked content)
>
> Then it fits more nicely with the output for files, no?
>
> We could drop the "Submodule has " if people see it as a waste of screen
> estate. Also i have no strong feelings about "content", i just happen to
> think it is more appropriate as submodules can contain not only files but
> other submodules too. Opinions?
>
> Will send a patch for discussion as soon as i have something to show ...
>   
How about

#	modified:   mod1 (submodule: new commit(s), modified content, untracked content)

trying to assure that what comes after the ":" is a list of comma 
separated properties.

This can make the thing easier to parse.  I know that there is a "git 
status ---porcelain" but from my understanding it will not be possible 
to get this kind of information from that command since its output 
format is frozen and not extensible, so many could resort to try to 
parse the "normal" git status output to get all the info about 
submodules at once.

Even better would be to have a "--interface_level 2" to go with 
---porcelain, to be able to pass this info even there.

BTW... about the --porcelain option, I wonder if considering an alias to 
--parseable could be on the list.  The plumbing/porcelain metaphor is 
really nice, but a --porcelain option can probably be a bit confusing 
for the beginner getting a

usage: git status [options] [--] <filepattern>...

    -v, --verbose         be verbose
    -s, --short           show status concisely
    --porcelain           show porcelain output format
    -z, --null            terminate entries with NUL
    -u, --untracked-files[=<mode>]
                          show untracked files, optional modes: all, 
normal, no. (Default: all)

considering that status is probably the first command the beginner may 
come into.

Sergio

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

end of thread, other threads:[~2010-02-20 11:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-17 19:14 Possible bug with git status in 1.7.0 Sergio
2010-02-17 19:21 ` Junio C Hamano
2010-02-17 19:52   ` Sergio Callegari
2010-02-17 20:52     ` Jens Lehmann
2010-02-19 16:42       ` Sergio Callegari
2010-02-19 20:55         ` Jens Lehmann
2010-02-20 11:05           ` Sergio Callegari

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