All of lore.kernel.org
 help / color / mirror / Atom feed
* git-apply does not work in a sub-directory of a Git repository
@ 2016-03-22 12:10 Mehul Jain
  2016-03-22 22:14 ` Stefan Beller
  0 siblings, 1 reply; 18+ messages in thread
From: Mehul Jain @ 2016-03-22 12:10 UTC (permalink / raw)
  To: Git Mailing List

Hello everyone,

Recently while using git-apply, I observed that if git-apply is used in a
sub-directory of a Git repository then it silently dies without doing
anything.

Here's what I did

~ $mkdir example
~ $cd example
example $git init
Initialized empty Git repository in /home/mj/example/.git/
example $echo main >main
example $git add main
example $git commit -m 'main'
[master (root-commit) 97aeda3] main
 1 file changed, 1 insertion(+)
 create mode 100644 main
example $git checkout -b feature
Switched to a new branch 'feature'
example $echo modified >main
example $git add main
example $git commit -m 'modified'
[feature 2551fa2] modified
 1 file changed, 1 insertion(+), 1 deletion(-)
example $mkdir outgoing
example $git diff master >outgoing/feature.patch
example $git checkout master
Switched to branch 'master'
example $cd outgoing/
outgoing $git apply feature.patch
outgoing $cd ..
example $cat main
main

As you observed, patch wasn't applied. Is it intended behaviour of
git-apply? Usually to apply the patch I have to copy it to top directory
and then use git-apply.

I tried out git-am to apply the patch ("git format-patch" was used to
make patch) while being in the "outgoing" sub-directory and it worked
fine. So why does git-apply show this kind of behaviour?

Thanks,
Mehul

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

end of thread, other threads:[~2016-03-30 17:14 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22 12:10 git-apply does not work in a sub-directory of a Git repository Mehul Jain
2016-03-22 22:14 ` Stefan Beller
2016-03-23 10:15   ` Duy Nguyen
2016-03-23 15:21     ` Junio C Hamano
2016-03-23 16:55       ` Junio C Hamano
2016-03-24 10:49         ` Duy Nguyen
2016-03-24 11:56           ` Nguyễn Thái Ngọc Duy
2016-03-24 11:56             ` [PATCH 1/4] git-apply.txt: remove a space Nguyễn Thái Ngọc Duy
2016-03-24 11:56             ` [PATCH 2/4] git-apply.txt: mention the behavior inside a subdir Nguyễn Thái Ngọc Duy
2016-03-24 11:56             ` [PATCH 3/4] apply: add --whole to apply git patch without prefix filtering Nguyễn Thái Ngọc Duy
2016-03-24 11:56             ` [PATCH 4/4] apply: report patch skipping in verbose mode Nguyễn Thái Ngọc Duy
2016-03-24 16:50             ` git-apply does not work in a sub-directory of a Git repository Junio C Hamano
2016-03-24 17:32               ` Junio C Hamano
2016-03-30  1:05               ` Duy Nguyen
2016-03-30 17:13                 ` Junio C Hamano
2016-03-30  9:33               ` Duy Nguyen
2016-03-24 16:29           ` Junio C Hamano
2016-03-23 17:24       ` Mehul Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.