public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Orion Poplawski <orion@cora•nwra.com>
To: git@vger•kernel.org
Subject: Using git apply inside a repository but on un-tracked files
Date: Thu, 10 May 2012 10:46:25 -0600	[thread overview]
Message-ID: <4FABF0E1.1040902@cora.nwra.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 994 bytes --]

I'm a Fedora package which tracks the the package files in git.  When the 
package source is unpacked it is unpacked under the git directory, however 
these files are not tracked by git.

I tried to use git apply to apply a patch (because it is coming mercurial and 
has diff --git rename info in it) to the package source.  However, the 
presence of a .git repo in the parent tree caused git apply to refuse to apply 
the patch, unfortunately silently without any complaint or error return code, 
even with --verbose.  I got it to work by passing the  appropriate --directory 
option, but this took me a long time to figure out due to the lack of a 
warning messages.  Could one be added please?  Perhaps like in the attached patch?

TIA,

  Orion

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder Office                  FAX: 303-415-9702
3380 Mitchell Lane                       orion@nwra•com
Boulder, CO 80301                   http://www.nwra.com

[-- Attachment #2: apply.patch --]
[-- Type: text/x-patch, Size: 504 bytes --]

--- apply.c.orig	2012-05-01 22:50:38.000000000 -0600
+++ apply.c	2012-05-10 10:45:10.744088807 -0600
@@ -3631,8 +3631,12 @@
 	if (0 < prefix_length) {
 		int pathlen = strlen(pathname);
 		if (pathlen <= prefix_length ||
-		    memcmp(prefix, pathname, prefix_length))
+		    memcmp(prefix, pathname, prefix_length)) {
+			if (apply_verbosely)
+				error("path '%s' is outide of git repo '%s'",
+				      pathname, prefix);
 			return 0;
+		}
 	}
 
 	/* See if it matches any of exclude/include rule */

                 reply	other threads:[~2012-05-10 17:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FABF0E1.1040902@cora.nwra.com \
    --to=orion@cora$(echo .)nwra.com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox