Comments (7)
Adding something like {$CHANGED_FILES}
sounds like a great idea.
Not sure everything is already there but BlockFixupAndSquashCommits
should be a good place to start.
I just looked at the current Placeholder
implementations. Currently they don't have access to IO
but they would need that in order to get the refs that will be pushed. You can not just assume that it will be master
.
Maybe you want to push to some feature branch or multiple branches at the same time.
But as I mentioned BlockFixupAndSquashCommits
is a good stating point to understand how to gather the necessary information.
I'm not getting the |base:<referecnce>
idea, what would that modifier do?
But yes, definitely open for something like this.
from captainhook.
I'm not getting the
|base:<referecnce>
idea, what would that modifier do?
As I said, the notion of changed files can be a bit ambiguous. Changed against what?.
In my mind, it means “The files you explicitely chnaged on your branch since you forked from the branch this will be merged into an the end”, or said differently in my workflow: “the files you changed sinced you forked from origin/master”. However, as you said, some will want another reference branch, like “origin/prod”, or even the remote reference being pushed to.
The {$CHANGED_FILES}|base:<referecnce>
would allow such customizations:
- in my own need, it would be
{$CHANGED_FILES|base:origin/master}
- it could also be
{$CHANGED_FILES|base:custom_remote/prod}
- and if empty, this could fallback on the remote reference being pushed to (However, I'm not sure this is possible in every case since this reference may not exist yet, and I'm not sure what I would like {$CHANGED_FILES} to return in this case
from captainhook.
You can not just define what you want your base to be.
If you are pushing to different branches this will fail.
You have to determine on push what the current local and remote states are.
Luckily git provides that information as stdIn
to the pre-push
hook.
You can check BlockFixupAndSquashCommits
for more details.
The most important thing is that you can push multiple branches at the same time.
So you receive potentially multiple LOCAL_STATE<-->REMOTE_STATE
combinations.
from captainhook.
I started working on this, hopefully I have something to test tonight
from captainhook.
In the case several references are pushed, with different changed files, what will be the value of this variable?
from captainhook.
I my opinion it should contain all files, so if you push file A
and B
to branch X and file C
and D
to branch Y the list should contain A, B, C, D
from captainhook.
Fixed with 5.15.4
from captainhook.
Related Issues (20)
- New Condition: File Of Type Pushed HOT 3
- Running with --move-existing gives Undefined array key "post-commit" HOT 1
- Allow specifying multiple hooks that will be limited during install command HOT 1
- [feature] condition about changed files at pre-push HOT 6
- LogicAnd condion does not allow to combine conditions per file HOT 4
- Version 5.16.2 broke git diff commands HOT 5
- Error whilst using docker for for the FileChanged/TypeOf condition HOT 14
- [feature] allow hooks to have a label HOT 3
- Path to the composer autoload bootstrap file is not using a "realpath" HOT 6
- STAGED_FILES greedy when there is conditions HOT 1
- Using $ENV in run-exec config HOT 3
- Support for Relative Path to CaptainHook Executable in Generated Hooks HOT 5
- Allow Staged and Changed files condition to define diff-filter HOT 1
- PHP Fatal error: Argument #2 ($filter) must be of type array HOT 7
- InjectIssueKeyFromBranch does not work as expected HOT 10
- http://captainhook.info is not available anymore? HOT 1
- Support Symfony 7 HOT 2
- $CHANGED_FILES placeholder is empty for first push HOT 1
- [FEATURE-REQUEST] New placeholder `ALL_CHANGED_FILES` HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from captainhook.