git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* more pedantry ... what means a file "known to Git"?
@ 2017-11-12  9:48 Robert P. J. Day
  2017-11-13 15:34 ` Philip Oakley
  0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2017-11-12  9:48 UTC (permalink / raw)
  To: Git Mailing list


  apologies for more excruciating nitpickery, but i ask since it seems
that phrase means slightly different things depending on where you
read it.

  first, i assume that there are only two categories:

  1) files known to Git
  2) files unknown to Git

and that there is no fuzzy, grey area middle ground, yes?

  now, in "man git-clean", one reads (near the top):

    Cleans the working tree by recursively removing files that are
    not under version control, starting from the current directory.

    Normally, only files unknown to Git are removed, but if the -x
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    option is specified, ignored files are also removed.

the way that's worded suggests that ignored files are "known" to Git,
yes? that is, if, by default, "git clean" removes only files "unknown"
to Git, and "-x" extends that to ignored files, the conclusion is that
ignored files are *known* to Git.

  if, however, you check out "man git-rm", you read:

    The <file> list given to the command can be exact pathnames,
    file glob patterns, or leading directory names. The command
    removes only the paths that are known to Git. Giving the name
                                    ^^^^^^^^^^^^
    of a file that you have not told Git about does not remove that file.

so "git rm" removes only files "known to Git", but from the above
regarding how "git clean" sees this, that should include ignored
files, which of course it doesn't.

  given that this phrase occurs in a number of places:

$ grep -ir "known to git" *
builtin/difftool.c:		/* The symlink is unknown to Git so read from the filesystem */
dir.c:		error("pathspec '%s' did not match any file(s) known to git.",
Documentation/git-rm.txt:removes only the paths that are known to Git.  Giving the name of
Documentation/git-commit.txt:   be known to Git);
Documentation/user-manual.txt:error: pathspec '261dfac35cb99d380eb966e102c1197139f7fa24' did not match any file(s) known to git.
Documentation/gitattributes.txt:	Notice all types of potential whitespace errors known to Git.
Documentation/git-clean.txt:Normally, only files unknown to Git are removed, but if the `-x`
Documentation/RelNotes/1.8.2.1.txt: * The code to keep track of what directory names are known to Git on
Documentation/RelNotes/1.8.1.6.txt: * The code to keep track of what directory names are known to Git on
Documentation/RelNotes/2.9.0.txt:   known to Git.  They have been taught to do the normalization.
Documentation/RelNotes/2.8.4.txt:   known to Git.  They have been taught to do the normalization.
Documentation/RelNotes/1.8.3.txt: * The code to keep track of what directory names are known to Git on
t/t3005-ls-files-relative.sh:			echo "error: pathspec $sq$f$sq did not match any file(s) known to git."
t/t3005-ls-files-relative.sh:			echo "error: pathspec $sq$f$sq did not match any file(s) known to git."
$

it might be useful to define precisely what it means. or is it assumed
to be context dependent?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

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

* Re: more pedantry ... what means a file "known to Git"?
  2017-11-12  9:48 more pedantry ... what means a file "known to Git"? Robert P. J. Day
@ 2017-11-13 15:34 ` Philip Oakley
  0 siblings, 0 replies; 2+ messages in thread
From: Philip Oakley @ 2017-11-13 15:34 UTC (permalink / raw)
  To: Robert P. J. Day, Git Mailing list

From: "Robert P. J. Day" <rpjday@crashcourse.ca>
>
>  apologies for more excruciating nitpickery, but i ask since it seems
> that phrase means slightly different things depending on where you
> read it.
>
>  first, i assume that there are only two categories:
>
>  1) files known to Git
>  2) files unknown to Git
>
> and that there is no fuzzy, grey area middle ground, yes?

sort of...
>
>  now, in "man git-clean", one reads (near the top):
>
>    Cleans the working tree by recursively removing files that are
>    not under version control, starting from the current directory.
>
>    Normally, only files unknown to Git are removed, but if the -x
>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    option is specified, ignored files are also removed.
>
> the way that's worded suggests that ignored files are "known" to Git,
> yes?

You've hit the three way binary problem of +1, 0, -1 ! The lsb is still 0 or 
1, but we have the two assertions of:
Positively known to git -- added to the index and the object store
Negatively 'known' to git -- paths we actively ignore, thus not in the index 
or object store.

Unknown files are those that could be added.

>  that is, if, by default, "git clean" removes only files "unknown"
> to Git, and "-x" extends that to ignored files, the conclusion is that
> ignored files are *known* to Git.

but only in a negative sense ...

>
>  if, however, you check out "man git-rm", you read:
>
>    The <file> list given to the command can be exact pathnames,
>    file glob patterns, or leading directory names. The command
>    removes only the paths that are known to Git. Giving the name
>                                    ^^^^^^^^^^^^
>    of a file that you have not told Git about does not remove that file.
>
> so "git rm" removes only files "known to Git", but from the above
> regarding how "git clean" sees this, that should include ignored
> files, which of course it doesn't.

The man page description starts with the key "Remove files from the index", 
so this is the positive 'knowing' part. Clearly it can never remove other 
ignored files as they can't be in the index (but note the 'other' caveat. 
P->Q # Q->P).

>
>  given that this phrase occurs in a number of places:
>
> $ grep -ir "known to git" *
> builtin/difftool.c: /* The symlink is unknown to Git so read from the 
> filesystem */
> dir.c: error("pathspec '%s' did not match any file(s) known to git.",
> Documentation/git-rm.txt:removes only the paths that are known to Git. 
> Giving the name of
> Documentation/git-commit.txt:   be known to Git);
> Documentation/user-manual.txt:error: pathspec 
> '261dfac35cb99d380eb966e102c1197139f7fa24' did not match any file(s) known 
> to git.
> Documentation/gitattributes.txt: Notice all types of potential whitespace 
> errors known to Git.
> Documentation/git-clean.txt:Normally, only files unknown to Git are 
> removed, but if the `-x`
> Documentation/RelNotes/1.8.2.1.txt: * The code to keep track of what 
> directory names are known to Git on
> Documentation/RelNotes/1.8.1.6.txt: * The code to keep track of what 
> directory names are known to Git on
> Documentation/RelNotes/2.9.0.txt:   known to Git.  They have been taught 
> to do the normalization.
> Documentation/RelNotes/2.8.4.txt:   known to Git.  They have been taught 
> to do the normalization.
> Documentation/RelNotes/1.8.3.txt: * The code to keep track of what 
> directory names are known to Git on
> t/t3005-ls-files-relative.sh: echo "error: pathspec $sq$f$sq did not match 
> any file(s) known to git."
> t/t3005-ls-files-relative.sh: echo "error: pathspec $sq$f$sq did not match 
> any file(s) known to git."
> $
>
> it might be useful to define precisely what it means. or is it assumed
> to be context dependent?


A little bit of clarification may be useful. You can't be/aren't the only 
one who is willing to note these subtle inconsistencies (Git knows things 
via the index (staging area) and the object store (repository)).
>
> rday
--
Philip================= 


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

end of thread, other threads:[~2017-11-13 15:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-12  9:48 more pedantry ... what means a file "known to Git"? Robert P. J. Day
2017-11-13 15:34 ` Philip Oakley

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git