Re: feature-request: git "cp" like there is git mv.
- From
- Stefan Moch <stefanmoch@mail.de>
- Date
- Dec 31, 2017, 19:11 UTC
- Message-ID
- <20171231191156.28359-1-stefanmoch@mail.de>
- In-Reply-To
- <20171216013130.GB188893@aiede.mtv.corp.google.com>
* Jonathan Nieder <jrnieder@gmail.com> [2017-12-15T17:31:30-0800]:
Show 7 quoted lines
> This sounds like a reasonable thing to add. See builtin/mv.c for how > "git mv" works if you're looking for inspiration. > > cmd_mv in that file looks rather long, so I'd also be happy if someone > interested refactors to break it into multiple self-contained pieces > for easier reading (git mostly follows > https://www.kernel.org/doc/html/latest/process/coding-style.html#functions).
I looked at builtin/mv.c and have a rough idea how to split it up to support both mv and cp commands.
But first I noticed and removed a redundant check in cmd_mv, also added a test case to check if mv --dry-run does not move the file.
Stefan