Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jgit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Faculty of Technology
Software Engineering
tools
cms
jgit
Commits
0df679ae
Commit
0df679ae
authored
14 years ago
by
Robin Rosenberg
Committed by
Code Review
14 years ago
Browse files
Options
Downloads
Plain Diff
Merge "A stages field and getter for GitIndex entry introduced"
parents
0f2d50b6
a496410d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java
+23
-0
23 additions, 0 deletions
org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java
with
23 additions
and
0 deletions
org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java
+
23
−
0
View file @
0df679ae
...
@@ -244,7 +244,11 @@ public void read() throws IOException {
...
@@ -244,7 +244,11 @@ public void read() throws IOException {
entries
.
clear
();
entries
.
clear
();
for
(
int
i
=
0
;
i
<
header
.
entries
;
++
i
)
{
for
(
int
i
=
0
;
i
<
header
.
entries
;
++
i
)
{
Entry
entry
=
new
Entry
(
buffer
);
Entry
entry
=
new
Entry
(
buffer
);
final
GitIndex
.
Entry
existing
=
entries
.
get
(
entry
.
name
);
entries
.
put
(
entry
.
name
,
entry
);
entries
.
put
(
entry
.
name
,
entry
);
if
(
existing
!=
null
)
{
entry
.
stages
|=
existing
.
stages
;
}
}
}
lastCacheTime
=
cacheFile
.
lastModified
();
lastCacheTime
=
cacheFile
.
lastModified
();
}
finally
{
}
finally
{
...
@@ -374,6 +378,8 @@ public class Entry {
...
@@ -374,6 +378,8 @@ public class Entry {
private
byte
[]
name
;
private
byte
[]
name
;
private
int
stages
;
Entry
(
byte
[]
key
,
File
f
,
int
stage
)
Entry
(
byte
[]
key
,
File
f
,
int
stage
)
throws
IOException
{
throws
IOException
{
ctime
=
f
.
lastModified
()
*
1000000L
;
ctime
=
f
.
lastModified
()
*
1000000L
;
...
@@ -391,6 +397,7 @@ public class Entry {
...
@@ -391,6 +397,7 @@ public class Entry {
sha1
=
writer
.
writeBlob
(
f
);
sha1
=
writer
.
writeBlob
(
f
);
name
=
key
;
name
=
key
;
flags
=
(
short
)
((
stage
<<
12
)
|
name
.
length
);
// TODO: fix flags
flags
=
(
short
)
((
stage
<<
12
)
|
name
.
length
);
// TODO: fix flags
stages
=
(
1
>>
getStage
());
}
}
Entry
(
byte
[]
key
,
File
f
,
int
stage
,
byte
[]
newContent
)
Entry
(
byte
[]
key
,
File
f
,
int
stage
,
byte
[]
newContent
)
...
@@ -410,6 +417,7 @@ public class Entry {
...
@@ -410,6 +417,7 @@ public class Entry {
sha1
=
writer
.
writeBlob
(
newContent
);
sha1
=
writer
.
writeBlob
(
newContent
);
name
=
key
;
name
=
key
;
flags
=
(
short
)
((
stage
<<
12
)
|
name
.
length
);
// TODO: fix flags
flags
=
(
short
)
((
stage
<<
12
)
|
name
.
length
);
// TODO: fix flags
stages
=
(
1
>>
getStage
());
}
}
Entry
(
TreeEntry
f
,
int
stage
)
{
Entry
(
TreeEntry
f
,
int
stage
)
{
...
@@ -429,6 +437,7 @@ public class Entry {
...
@@ -429,6 +437,7 @@ public class Entry {
sha1
=
f
.
getId
();
sha1
=
f
.
getId
();
name
=
Constants
.
encode
(
f
.
getFullName
());
name
=
Constants
.
encode
(
f
.
getFullName
());
flags
=
(
short
)
((
stage
<<
12
)
|
name
.
length
);
// TODO: fix flags
flags
=
(
short
)
((
stage
<<
12
)
|
name
.
length
);
// TODO: fix flags
stages
=
(
1
>>
getStage
());
}
}
Entry
(
ByteBuffer
b
)
{
Entry
(
ByteBuffer
b
)
{
...
@@ -445,6 +454,7 @@ public class Entry {
...
@@ -445,6 +454,7 @@ public class Entry {
b
.
get
(
sha1bytes
);
b
.
get
(
sha1bytes
);
sha1
=
ObjectId
.
fromRaw
(
sha1bytes
);
sha1
=
ObjectId
.
fromRaw
(
sha1bytes
);
flags
=
b
.
getShort
();
flags
=
b
.
getShort
();
stages
=
(
1
<<
getStage
());
name
=
new
byte
[
flags
&
0xFFF
];
name
=
new
byte
[
flags
&
0xFFF
];
b
.
get
(
name
);
b
.
get
(
name
);
b
b
...
@@ -643,6 +653,19 @@ public boolean isModified(File wd, boolean forceContentCheck) {
...
@@ -643,6 +653,19 @@ public boolean isModified(File wd, boolean forceContentCheck) {
return
false
;
return
false
;
}
}
/**
* Returns the stages in which the entry's file is recorded in the index.
* The stages are bit-encoded: bit N is set if the file is present
* in stage N. In particular, the N-th bit will be set if this entry
* itself is in stage N (see getStage()).
*
* @return flags denoting stages
* @see #getStage()
*/
public
int
getStages
()
{
return
stages
;
}
// for testing
// for testing
void
forceRecheck
()
{
void
forceRecheck
()
{
mtime
=
-
1
;
mtime
=
-
1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment