summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2022-08-10 17:46:12 +0200
committerHan-Wen NIenhuys <hanwen@google.com>2022-08-23 09:23:23 -0400
commit25aceffdc58fdc5707c908fb4c3584116703046e (patch)
treef17b2e5377fb631beaaed605476e13189a48af42 /org.eclipse.jgit
parent0887111ba525c7c9c4dea3018028a40041cec49b (diff)
downloadjgit-25aceffdc58fdc5707c908fb4c3584116703046e.tar.gz
jgit-25aceffdc58fdc5707c908fb4c3584116703046e.zip
ApplyCommand: fix ApplyResult#updatedFiles
On executing a copy, mark the destination as updated. On executing a rename, mark both source and destination as updated. Change-Id: Ied5b9b0e5a14eac59a06cdd0961e25e143f50ff0
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
index 88bc7ddd2d..64fba98b49 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
@@ -157,13 +157,14 @@ public class ApplyCommand extends GitCommand<ApplyResult> {
JGitText.get().renameFileFailed, f, dest), e);
}
apply(repository, fh.getOldPath(), cache, dest, fh);
+ r.addUpdatedFile(dest);
break;
case COPY:
- f = getFile(fh.getOldPath(), false);
- File target = getFile(fh.getNewPath(), false);
- FileUtils.mkdirs(target.getParentFile(), true);
- Files.copy(f.toPath(), target.toPath());
- apply(repository, fh.getOldPath(), cache, target, fh);
+ File src = getFile(fh.getOldPath(), false);
+ f = getFile(fh.getNewPath(), false);
+ FileUtils.mkdirs(f.getParentFile(), true);
+ Files.copy(src.toPath(), f.toPath());
+ apply(repository, fh.getOldPath(), cache, f, fh);
}
r.addUpdatedFile(f);
}