You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I think this feature could alleviate some of the issues discussed in #323. The problem is that sometimes you might not notice that a commit starts tracking a new file that wasn't present in the parent, and you might accidentally push it to the remote. This is also related to #4154, but I think it's a different feature (since these file counts are different from the --shortstat counts).
Describe the solution you'd like
If there were a template method or chain of methods (e.g. commit.diff().added_files().len()) that returned the number of new files in the commit, then it would be possible to use the template to display commits which add files differently in the log. For instance, a +N could be added to the log for commits which add new files, and then a user could review the added files to make sure there's nothing that they added accidentally (since for many repos, it's relatively rare to add a new file):
@ ppnpzvyl scott.g.taylor 10 seconds ago a364b1b2 +1
│ (no description set)
◆ skmnsovu Christian.Stoitner 6 hours ago main bcfa2b17
│ added changelog entry for showing untracked files in `jj status`
~
For consistency, we could add the following methods to TreeDiff:
added_files() -> List<String>
modified_files() -> List<String>
deleted_files() -> List<String>
renamed_files() -> List<String>
copied_files() -> List<String>
Describe alternatives you've considered
Instead of being a template method, it could just be a revset for commits which add any new files. Then it would be necessary to use the contained_in(revset) commit template method to show it in a template. I think this isn't ideal, because it wouldn't be possible to show the count of files in the template, and showing the count could be useful (for instance, if a commit adds 500 files, it's often going to be a mistake).
We could add a fileset for added files, and then use commit.diff("added()").files().len() instead. I think this is a bit more complicated though, since it's unclear in what contexts added() would be a valid fileset, and currently all filesets are valid in all contexts I believe.
We could also decide that this isn't necessary, and that the user should use jj status or jj log --summary to check for added files.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I think this feature could alleviate some of the issues discussed in #323. The problem is that sometimes you might not notice that a commit starts tracking a new file that wasn't present in the parent, and you might accidentally push it to the remote. This is also related to #4154, but I think it's a different feature (since these file counts are different from the
--shortstat
counts).Describe the solution you'd like
If there were a template method or chain of methods (e.g.
commit.diff().added_files().len()
) that returned the number of new files in the commit, then it would be possible to use the template to display commits which add files differently in the log. For instance, a+N
could be added to the log for commits which add new files, and then a user could review the added files to make sure there's nothing that they added accidentally (since for many repos, it's relatively rare to add a new file):For consistency, we could add the following methods to
TreeDiff
:added_files() -> List<String>
modified_files() -> List<String>
deleted_files() -> List<String>
renamed_files() -> List<String>
copied_files() -> List<String>
Describe alternatives you've considered
Instead of being a template method, it could just be a revset for commits which add any new files. Then it would be necessary to use the
contained_in(revset)
commit template method to show it in a template. I think this isn't ideal, because it wouldn't be possible to show the count of files in the template, and showing the count could be useful (for instance, if a commit adds 500 files, it's often going to be a mistake).We could add a fileset for added files, and then use
commit.diff("added()").files().len()
instead. I think this is a bit more complicated though, since it's unclear in what contextsadded()
would be a valid fileset, and currently all filesets are valid in all contexts I believe.We could also decide that this isn't necessary, and that the user should use
jj status
orjj log --summary
to check for added files.The text was updated successfully, but these errors were encountered: